/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
/**
 * Autogenerated by Thrift Compiler (0.13.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package org.apache.pinot.plugin.inputformat.thrift;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
public class ComplexTypes implements org.apache.thrift.TBase<ComplexTypes, ComplexTypes._Fields>, java.io.Serializable, Cloneable, Comparable<ComplexTypes> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ComplexTypes");

  private static final org.apache.thrift.protocol.TField INT_FIELD_FIELD_DESC = new org.apache.thrift.protocol.TField("intField", org.apache.thrift.protocol.TType.I32, (short)1);
  private static final org.apache.thrift.protocol.TField LONG_FIELD_FIELD_DESC = new org.apache.thrift.protocol.TField("longField", org.apache.thrift.protocol.TType.I64, (short)2);
  private static final org.apache.thrift.protocol.TField BOOLEAN_FIELD_FIELD_DESC = new org.apache.thrift.protocol.TField("booleanField", org.apache.thrift.protocol.TType.BOOL, (short)3);
  private static final org.apache.thrift.protocol.TField DOUBLE_FIELD_FIELD_DESC = new org.apache.thrift.protocol.TField("doubleField", org.apache.thrift.protocol.TType.DOUBLE, (short)4);
  private static final org.apache.thrift.protocol.TField STRING_FIELD_FIELD_DESC = new org.apache.thrift.protocol.TField("stringField", org.apache.thrift.protocol.TType.STRING, (short)5);
  private static final org.apache.thrift.protocol.TField ENUM_FIELD_FIELD_DESC = new org.apache.thrift.protocol.TField("enumField", org.apache.thrift.protocol.TType.I32, (short)6);
  private static final org.apache.thrift.protocol.TField OPTIONAL_STRING_FIELD_FIELD_DESC = new org.apache.thrift.protocol.TField("optionalStringField", org.apache.thrift.protocol.TType.STRING, (short)7);
  private static final org.apache.thrift.protocol.TField NESTED_STRUCT_FIELD_FIELD_DESC = new org.apache.thrift.protocol.TField("nestedStructField", org.apache.thrift.protocol.TType.STRUCT, (short)8);
  private static final org.apache.thrift.protocol.TField SIMPLE_LIST_FIELD_FIELD_DESC = new org.apache.thrift.protocol.TField("simpleListField", org.apache.thrift.protocol.TType.LIST, (short)9);
  private static final org.apache.thrift.protocol.TField COMPLEX_LIST_FIELD_FIELD_DESC = new org.apache.thrift.protocol.TField("complexListField", org.apache.thrift.protocol.TType.LIST, (short)10);
  private static final org.apache.thrift.protocol.TField SIMPLE_MAP_FIELD_FIELD_DESC = new org.apache.thrift.protocol.TField("simpleMapField", org.apache.thrift.protocol.TType.MAP, (short)15);
  private static final org.apache.thrift.protocol.TField COMPLEX_MAP_FIELD_FIELD_DESC = new org.apache.thrift.protocol.TField("complexMapField", org.apache.thrift.protocol.TType.MAP, (short)16);

  private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new ComplexTypesStandardSchemeFactory();
  private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new ComplexTypesTupleSchemeFactory();

  public int intField; // required
  public long longField; // required
  public boolean booleanField; // required
  public double doubleField; // required
  public @org.apache.thrift.annotation.Nullable java.lang.String stringField; // required
  public @org.apache.thrift.annotation.Nullable TestEnum enumField; // required
  public @org.apache.thrift.annotation.Nullable java.lang.String optionalStringField; // optional
  public @org.apache.thrift.annotation.Nullable NestedType nestedStructField; // required
  public @org.apache.thrift.annotation.Nullable java.util.List<java.lang.String> simpleListField; // required
  public @org.apache.thrift.annotation.Nullable java.util.List<NestedType> complexListField; // required
  public @org.apache.thrift.annotation.Nullable java.util.Map<java.lang.String,java.lang.Integer> simpleMapField; // required
  public @org.apache.thrift.annotation.Nullable java.util.Map<java.lang.String,NestedType> complexMapField; // required

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    INT_FIELD((short)1, "intField"),
    LONG_FIELD((short)2, "longField"),
    BOOLEAN_FIELD((short)3, "booleanField"),
    DOUBLE_FIELD((short)4, "doubleField"),
    STRING_FIELD((short)5, "stringField"),
    ENUM_FIELD((short)6, "enumField"),
    OPTIONAL_STRING_FIELD((short)7, "optionalStringField"),
    NESTED_STRUCT_FIELD((short)8, "nestedStructField"),
    SIMPLE_LIST_FIELD((short)9, "simpleListField"),
    COMPLEX_LIST_FIELD((short)10, "complexListField"),
    SIMPLE_MAP_FIELD((short)15, "simpleMapField"),
    COMPLEX_MAP_FIELD((short)16, "complexMapField");

    private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();

    static {
      for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // INT_FIELD
          return INT_FIELD;
        case 2: // LONG_FIELD
          return LONG_FIELD;
        case 3: // BOOLEAN_FIELD
          return BOOLEAN_FIELD;
        case 4: // DOUBLE_FIELD
          return DOUBLE_FIELD;
        case 5: // STRING_FIELD
          return STRING_FIELD;
        case 6: // ENUM_FIELD
          return ENUM_FIELD;
        case 7: // OPTIONAL_STRING_FIELD
          return OPTIONAL_STRING_FIELD;
        case 8: // NESTED_STRUCT_FIELD
          return NESTED_STRUCT_FIELD;
        case 9: // SIMPLE_LIST_FIELD
          return SIMPLE_LIST_FIELD;
        case 10: // COMPLEX_LIST_FIELD
          return COMPLEX_LIST_FIELD;
        case 15: // SIMPLE_MAP_FIELD
          return SIMPLE_MAP_FIELD;
        case 16: // COMPLEX_MAP_FIELD
          return COMPLEX_MAP_FIELD;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByName(java.lang.String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final java.lang.String _fieldName;

    _Fields(short thriftId, java.lang.String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public java.lang.String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final int __INTFIELD_ISSET_ID = 0;
  private static final int __LONGFIELD_ISSET_ID = 1;
  private static final int __BOOLEANFIELD_ISSET_ID = 2;
  private static final int __DOUBLEFIELD_ISSET_ID = 3;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.OPTIONAL_STRING_FIELD};
  public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.INT_FIELD, new org.apache.thrift.meta_data.FieldMetaData("intField", org.apache.thrift.TFieldRequirementType.REQUIRED,
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.LONG_FIELD, new org.apache.thrift.meta_data.FieldMetaData("longField", org.apache.thrift.TFieldRequirementType.REQUIRED,
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.BOOLEAN_FIELD, new org.apache.thrift.meta_data.FieldMetaData("booleanField", org.apache.thrift.TFieldRequirementType.REQUIRED,
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.DOUBLE_FIELD, new org.apache.thrift.meta_data.FieldMetaData("doubleField", org.apache.thrift.TFieldRequirementType.REQUIRED,
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.STRING_FIELD, new org.apache.thrift.meta_data.FieldMetaData("stringField", org.apache.thrift.TFieldRequirementType.REQUIRED,
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.ENUM_FIELD, new org.apache.thrift.meta_data.FieldMetaData("enumField", org.apache.thrift.TFieldRequirementType.REQUIRED,
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.ENUM        , "TestEnum")));
    tmpMap.put(_Fields.OPTIONAL_STRING_FIELD, new org.apache.thrift.meta_data.FieldMetaData("optionalStringField", org.apache.thrift.TFieldRequirementType.OPTIONAL,
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.NESTED_STRUCT_FIELD, new org.apache.thrift.meta_data.FieldMetaData("nestedStructField", org.apache.thrift.TFieldRequirementType.REQUIRED,
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT        , "NestedType")));
    tmpMap.put(_Fields.SIMPLE_LIST_FIELD, new org.apache.thrift.meta_data.FieldMetaData("simpleListField", org.apache.thrift.TFieldRequirementType.REQUIRED,
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
    tmpMap.put(_Fields.COMPLEX_LIST_FIELD, new org.apache.thrift.meta_data.FieldMetaData("complexListField", org.apache.thrift.TFieldRequirementType.REQUIRED,
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT            , "NestedType"))));
    tmpMap.put(_Fields.SIMPLE_MAP_FIELD, new org.apache.thrift.meta_data.FieldMetaData("simpleMapField", org.apache.thrift.TFieldRequirementType.DEFAULT,
        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING),
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))));
    tmpMap.put(_Fields.COMPLEX_MAP_FIELD, new org.apache.thrift.meta_data.FieldMetaData("complexMapField", org.apache.thrift.TFieldRequirementType.DEFAULT,
        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING),
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT            , "NestedType"))));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ComplexTypes.class, metaDataMap);
  }

  public ComplexTypes() {
  }

  public ComplexTypes(
    int intField,
    long longField,
    boolean booleanField,
    double doubleField,
    java.lang.String stringField,
    TestEnum enumField,
    NestedType nestedStructField,
    java.util.List<java.lang.String> simpleListField,
    java.util.List<NestedType> complexListField,
    java.util.Map<java.lang.String,java.lang.Integer> simpleMapField,
    java.util.Map<java.lang.String,NestedType> complexMapField)
  {
    this();
    this.intField = intField;
    setIntFieldIsSet(true);
    this.longField = longField;
    setLongFieldIsSet(true);
    this.booleanField = booleanField;
    setBooleanFieldIsSet(true);
    this.doubleField = doubleField;
    setDoubleFieldIsSet(true);
    this.stringField = stringField;
    this.enumField = enumField;
    this.nestedStructField = nestedStructField;
    this.simpleListField = simpleListField;
    this.complexListField = complexListField;
    this.simpleMapField = simpleMapField;
    this.complexMapField = complexMapField;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public ComplexTypes(ComplexTypes other) {
    __isset_bitfield = other.__isset_bitfield;
    this.intField = other.intField;
    this.longField = other.longField;
    this.booleanField = other.booleanField;
    this.doubleField = other.doubleField;
    if (other.isSetStringField()) {
      this.stringField = other.stringField;
    }
    if (other.isSetEnumField()) {
      this.enumField = other.enumField;
    }
    if (other.isSetOptionalStringField()) {
      this.optionalStringField = other.optionalStringField;
    }
    if (other.isSetNestedStructField()) {
      this.nestedStructField = new NestedType(other.nestedStructField);
    }
    if (other.isSetSimpleListField()) {
      java.util.List<java.lang.String> __this__simpleListField = new java.util.ArrayList<java.lang.String>(other.simpleListField);
      this.simpleListField = __this__simpleListField;
    }
    if (other.isSetComplexListField()) {
      java.util.List<NestedType> __this__complexListField = new java.util.ArrayList<NestedType>(other.complexListField.size());
      for (NestedType other_element : other.complexListField) {
        __this__complexListField.add(new NestedType(other_element));
      }
      this.complexListField = __this__complexListField;
    }
    if (other.isSetSimpleMapField()) {
      java.util.Map<java.lang.String,java.lang.Integer> __this__simpleMapField = new java.util.HashMap<java.lang.String,java.lang.Integer>(other.simpleMapField);
      this.simpleMapField = __this__simpleMapField;
    }
    if (other.isSetComplexMapField()) {
      java.util.Map<java.lang.String,NestedType> __this__complexMapField = new java.util.HashMap<java.lang.String,NestedType>(other.complexMapField.size());
      for (java.util.Map.Entry<java.lang.String, NestedType> other_element : other.complexMapField.entrySet()) {

        java.lang.String other_element_key = other_element.getKey();
        NestedType other_element_value = other_element.getValue();

        java.lang.String __this__complexMapField_copy_key = other_element_key;

        NestedType __this__complexMapField_copy_value = new NestedType(other_element_value);

        __this__complexMapField.put(__this__complexMapField_copy_key, __this__complexMapField_copy_value);
      }
      this.complexMapField = __this__complexMapField;
    }
  }

  public ComplexTypes deepCopy() {
    return new ComplexTypes(this);
  }

  @Override
  public void clear() {
    setIntFieldIsSet(false);
    this.intField = 0;
    setLongFieldIsSet(false);
    this.longField = 0;
    setBooleanFieldIsSet(false);
    this.booleanField = false;
    setDoubleFieldIsSet(false);
    this.doubleField = 0.0;
    this.stringField = null;
    this.enumField = null;
    this.optionalStringField = null;
    this.nestedStructField = null;
    this.simpleListField = null;
    this.complexListField = null;
    this.simpleMapField = null;
    this.complexMapField = null;
  }

  public int getIntField() {
    return this.intField;
  }

  public ComplexTypes setIntField(int intField) {
    this.intField = intField;
    setIntFieldIsSet(true);
    return this;
  }

  public void unsetIntField() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __INTFIELD_ISSET_ID);
  }

  /** Returns true if field intField is set (has been assigned a value) and false otherwise */
  public boolean isSetIntField() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __INTFIELD_ISSET_ID);
  }

  public void setIntFieldIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __INTFIELD_ISSET_ID, value);
  }

  public long getLongField() {
    return this.longField;
  }

  public ComplexTypes setLongField(long longField) {
    this.longField = longField;
    setLongFieldIsSet(true);
    return this;
  }

  public void unsetLongField() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __LONGFIELD_ISSET_ID);
  }

  /** Returns true if field longField is set (has been assigned a value) and false otherwise */
  public boolean isSetLongField() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __LONGFIELD_ISSET_ID);
  }

  public void setLongFieldIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __LONGFIELD_ISSET_ID, value);
  }

  public boolean isBooleanField() {
    return this.booleanField;
  }

  public ComplexTypes setBooleanField(boolean booleanField) {
    this.booleanField = booleanField;
    setBooleanFieldIsSet(true);
    return this;
  }

  public void unsetBooleanField() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __BOOLEANFIELD_ISSET_ID);
  }

  /** Returns true if field booleanField is set (has been assigned a value) and false otherwise */
  public boolean isSetBooleanField() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __BOOLEANFIELD_ISSET_ID);
  }

  public void setBooleanFieldIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __BOOLEANFIELD_ISSET_ID, value);
  }

  public double getDoubleField() {
    return this.doubleField;
  }

  public ComplexTypes setDoubleField(double doubleField) {
    this.doubleField = doubleField;
    setDoubleFieldIsSet(true);
    return this;
  }

  public void unsetDoubleField() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DOUBLEFIELD_ISSET_ID);
  }

  /** Returns true if field doubleField is set (has been assigned a value) and false otherwise */
  public boolean isSetDoubleField() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DOUBLEFIELD_ISSET_ID);
  }

  public void setDoubleFieldIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DOUBLEFIELD_ISSET_ID, value);
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getStringField() {
    return this.stringField;
  }

  public ComplexTypes setStringField(@org.apache.thrift.annotation.Nullable java.lang.String stringField) {
    this.stringField = stringField;
    return this;
  }

  public void unsetStringField() {
    this.stringField = null;
  }

  /** Returns true if field stringField is set (has been assigned a value) and false otherwise */
  public boolean isSetStringField() {
    return this.stringField != null;
  }

  public void setStringFieldIsSet(boolean value) {
    if (!value) {
      this.stringField = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public TestEnum getEnumField() {
    return this.enumField;
  }

  public ComplexTypes setEnumField(@org.apache.thrift.annotation.Nullable TestEnum enumField) {
    this.enumField = enumField;
    return this;
  }

  public void unsetEnumField() {
    this.enumField = null;
  }

  /** Returns true if field enumField is set (has been assigned a value) and false otherwise */
  public boolean isSetEnumField() {
    return this.enumField != null;
  }

  public void setEnumFieldIsSet(boolean value) {
    if (!value) {
      this.enumField = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getOptionalStringField() {
    return this.optionalStringField;
  }

  public ComplexTypes setOptionalStringField(@org.apache.thrift.annotation.Nullable java.lang.String optionalStringField) {
    this.optionalStringField = optionalStringField;
    return this;
  }

  public void unsetOptionalStringField() {
    this.optionalStringField = null;
  }

  /** Returns true if field optionalStringField is set (has been assigned a value) and false otherwise */
  public boolean isSetOptionalStringField() {
    return this.optionalStringField != null;
  }

  public void setOptionalStringFieldIsSet(boolean value) {
    if (!value) {
      this.optionalStringField = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public NestedType getNestedStructField() {
    return this.nestedStructField;
  }

  public ComplexTypes setNestedStructField(@org.apache.thrift.annotation.Nullable NestedType nestedStructField) {
    this.nestedStructField = nestedStructField;
    return this;
  }

  public void unsetNestedStructField() {
    this.nestedStructField = null;
  }

  /** Returns true if field nestedStructField is set (has been assigned a value) and false otherwise */
  public boolean isSetNestedStructField() {
    return this.nestedStructField != null;
  }

  public void setNestedStructFieldIsSet(boolean value) {
    if (!value) {
      this.nestedStructField = null;
    }
  }

  public int getSimpleListFieldSize() {
    return (this.simpleListField == null) ? 0 : this.simpleListField.size();
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator<java.lang.String> getSimpleListFieldIterator() {
    return (this.simpleListField == null) ? null : this.simpleListField.iterator();
  }

  public void addToSimpleListField(java.lang.String elem) {
    if (this.simpleListField == null) {
      this.simpleListField = new java.util.ArrayList<java.lang.String>();
    }
    this.simpleListField.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List<java.lang.String> getSimpleListField() {
    return this.simpleListField;
  }

  public ComplexTypes setSimpleListField(@org.apache.thrift.annotation.Nullable java.util.List<java.lang.String> simpleListField) {
    this.simpleListField = simpleListField;
    return this;
  }

  public void unsetSimpleListField() {
    this.simpleListField = null;
  }

  /** Returns true if field simpleListField is set (has been assigned a value) and false otherwise */
  public boolean isSetSimpleListField() {
    return this.simpleListField != null;
  }

  public void setSimpleListFieldIsSet(boolean value) {
    if (!value) {
      this.simpleListField = null;
    }
  }

  public int getComplexListFieldSize() {
    return (this.complexListField == null) ? 0 : this.complexListField.size();
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator<NestedType> getComplexListFieldIterator() {
    return (this.complexListField == null) ? null : this.complexListField.iterator();
  }

  public void addToComplexListField(NestedType elem) {
    if (this.complexListField == null) {
      this.complexListField = new java.util.ArrayList<NestedType>();
    }
    this.complexListField.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List<NestedType> getComplexListField() {
    return this.complexListField;
  }

  public ComplexTypes setComplexListField(@org.apache.thrift.annotation.Nullable java.util.List<NestedType> complexListField) {
    this.complexListField = complexListField;
    return this;
  }

  public void unsetComplexListField() {
    this.complexListField = null;
  }

  /** Returns true if field complexListField is set (has been assigned a value) and false otherwise */
  public boolean isSetComplexListField() {
    return this.complexListField != null;
  }

  public void setComplexListFieldIsSet(boolean value) {
    if (!value) {
      this.complexListField = null;
    }
  }

  public int getSimpleMapFieldSize() {
    return (this.simpleMapField == null) ? 0 : this.simpleMapField.size();
  }

  public void putToSimpleMapField(java.lang.String key, int val) {
    if (this.simpleMapField == null) {
      this.simpleMapField = new java.util.HashMap<java.lang.String,java.lang.Integer>();
    }
    this.simpleMapField.put(key, val);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Map<java.lang.String,java.lang.Integer> getSimpleMapField() {
    return this.simpleMapField;
  }

  public ComplexTypes setSimpleMapField(@org.apache.thrift.annotation.Nullable java.util.Map<java.lang.String,java.lang.Integer> simpleMapField) {
    this.simpleMapField = simpleMapField;
    return this;
  }

  public void unsetSimpleMapField() {
    this.simpleMapField = null;
  }

  /** Returns true if field simpleMapField is set (has been assigned a value) and false otherwise */
  public boolean isSetSimpleMapField() {
    return this.simpleMapField != null;
  }

  public void setSimpleMapFieldIsSet(boolean value) {
    if (!value) {
      this.simpleMapField = null;
    }
  }

  public int getComplexMapFieldSize() {
    return (this.complexMapField == null) ? 0 : this.complexMapField.size();
  }

  public void putToComplexMapField(java.lang.String key, NestedType val) {
    if (this.complexMapField == null) {
      this.complexMapField = new java.util.HashMap<java.lang.String,NestedType>();
    }
    this.complexMapField.put(key, val);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Map<java.lang.String,NestedType> getComplexMapField() {
    return this.complexMapField;
  }

  public ComplexTypes setComplexMapField(@org.apache.thrift.annotation.Nullable java.util.Map<java.lang.String,NestedType> complexMapField) {
    this.complexMapField = complexMapField;
    return this;
  }

  public void unsetComplexMapField() {
    this.complexMapField = null;
  }

  /** Returns true if field complexMapField is set (has been assigned a value) and false otherwise */
  public boolean isSetComplexMapField() {
    return this.complexMapField != null;
  }

  public void setComplexMapFieldIsSet(boolean value) {
    if (!value) {
      this.complexMapField = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case INT_FIELD:
      if (value == null) {
        unsetIntField();
      } else {
        setIntField((java.lang.Integer)value);
      }
      break;

    case LONG_FIELD:
      if (value == null) {
        unsetLongField();
      } else {
        setLongField((java.lang.Long)value);
      }
      break;

    case BOOLEAN_FIELD:
      if (value == null) {
        unsetBooleanField();
      } else {
        setBooleanField((java.lang.Boolean)value);
      }
      break;

    case DOUBLE_FIELD:
      if (value == null) {
        unsetDoubleField();
      } else {
        setDoubleField((java.lang.Double)value);
      }
      break;

    case STRING_FIELD:
      if (value == null) {
        unsetStringField();
      } else {
        setStringField((java.lang.String)value);
      }
      break;

    case ENUM_FIELD:
      if (value == null) {
        unsetEnumField();
      } else {
        setEnumField((TestEnum)value);
      }
      break;

    case OPTIONAL_STRING_FIELD:
      if (value == null) {
        unsetOptionalStringField();
      } else {
        setOptionalStringField((java.lang.String)value);
      }
      break;

    case NESTED_STRUCT_FIELD:
      if (value == null) {
        unsetNestedStructField();
      } else {
        setNestedStructField((NestedType)value);
      }
      break;

    case SIMPLE_LIST_FIELD:
      if (value == null) {
        unsetSimpleListField();
      } else {
        setSimpleListField((java.util.List<java.lang.String>)value);
      }
      break;

    case COMPLEX_LIST_FIELD:
      if (value == null) {
        unsetComplexListField();
      } else {
        setComplexListField((java.util.List<NestedType>)value);
      }
      break;

    case SIMPLE_MAP_FIELD:
      if (value == null) {
        unsetSimpleMapField();
      } else {
        setSimpleMapField((java.util.Map<java.lang.String,java.lang.Integer>)value);
      }
      break;

    case COMPLEX_MAP_FIELD:
      if (value == null) {
        unsetComplexMapField();
      } else {
        setComplexMapField((java.util.Map<java.lang.String,NestedType>)value);
      }
      break;

    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.Object getFieldValue(_Fields field) {
    switch (field) {
    case INT_FIELD:
      return getIntField();

    case LONG_FIELD:
      return getLongField();

    case BOOLEAN_FIELD:
      return isBooleanField();

    case DOUBLE_FIELD:
      return getDoubleField();

    case STRING_FIELD:
      return getStringField();

    case ENUM_FIELD:
      return getEnumField();

    case OPTIONAL_STRING_FIELD:
      return getOptionalStringField();

    case NESTED_STRUCT_FIELD:
      return getNestedStructField();

    case SIMPLE_LIST_FIELD:
      return getSimpleListField();

    case COMPLEX_LIST_FIELD:
      return getComplexListField();

    case SIMPLE_MAP_FIELD:
      return getSimpleMapField();

    case COMPLEX_MAP_FIELD:
      return getComplexMapField();

    }
    throw new java.lang.IllegalStateException();
  }

  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    if (field == null) {
      throw new java.lang.IllegalArgumentException();
    }

    switch (field) {
    case INT_FIELD:
      return isSetIntField();
    case LONG_FIELD:
      return isSetLongField();
    case BOOLEAN_FIELD:
      return isSetBooleanField();
    case DOUBLE_FIELD:
      return isSetDoubleField();
    case STRING_FIELD:
      return isSetStringField();
    case ENUM_FIELD:
      return isSetEnumField();
    case OPTIONAL_STRING_FIELD:
      return isSetOptionalStringField();
    case NESTED_STRUCT_FIELD:
      return isSetNestedStructField();
    case SIMPLE_LIST_FIELD:
      return isSetSimpleListField();
    case COMPLEX_LIST_FIELD:
      return isSetComplexListField();
    case SIMPLE_MAP_FIELD:
      return isSetSimpleMapField();
    case COMPLEX_MAP_FIELD:
      return isSetComplexMapField();
    }
    throw new java.lang.IllegalStateException();
  }

  @Override
  public boolean equals(java.lang.Object that) {
    if (that == null)
      return false;
    if (that instanceof ComplexTypes)
      return this.equals((ComplexTypes)that);
    return false;
  }

  public boolean equals(ComplexTypes that) {
    if (that == null)
      return false;
    if (this == that)
      return true;

    boolean this_present_intField = true;
    boolean that_present_intField = true;
    if (this_present_intField || that_present_intField) {
      if (!(this_present_intField && that_present_intField))
        return false;
      if (this.intField != that.intField)
        return false;
    }

    boolean this_present_longField = true;
    boolean that_present_longField = true;
    if (this_present_longField || that_present_longField) {
      if (!(this_present_longField && that_present_longField))
        return false;
      if (this.longField != that.longField)
        return false;
    }

    boolean this_present_booleanField = true;
    boolean that_present_booleanField = true;
    if (this_present_booleanField || that_present_booleanField) {
      if (!(this_present_booleanField && that_present_booleanField))
        return false;
      if (this.booleanField != that.booleanField)
        return false;
    }

    boolean this_present_doubleField = true;
    boolean that_present_doubleField = true;
    if (this_present_doubleField || that_present_doubleField) {
      if (!(this_present_doubleField && that_present_doubleField))
        return false;
      if (this.doubleField != that.doubleField)
        return false;
    }

    boolean this_present_stringField = true && this.isSetStringField();
    boolean that_present_stringField = true && that.isSetStringField();
    if (this_present_stringField || that_present_stringField) {
      if (!(this_present_stringField && that_present_stringField))
        return false;
      if (!this.stringField.equals(that.stringField))
        return false;
    }

    boolean this_present_enumField = true && this.isSetEnumField();
    boolean that_present_enumField = true && that.isSetEnumField();
    if (this_present_enumField || that_present_enumField) {
      if (!(this_present_enumField && that_present_enumField))
        return false;
      if (!this.enumField.equals(that.enumField))
        return false;
    }

    boolean this_present_optionalStringField = true && this.isSetOptionalStringField();
    boolean that_present_optionalStringField = true && that.isSetOptionalStringField();
    if (this_present_optionalStringField || that_present_optionalStringField) {
      if (!(this_present_optionalStringField && that_present_optionalStringField))
        return false;
      if (!this.optionalStringField.equals(that.optionalStringField))
        return false;
    }

    boolean this_present_nestedStructField = true && this.isSetNestedStructField();
    boolean that_present_nestedStructField = true && that.isSetNestedStructField();
    if (this_present_nestedStructField || that_present_nestedStructField) {
      if (!(this_present_nestedStructField && that_present_nestedStructField))
        return false;
      if (!this.nestedStructField.equals(that.nestedStructField))
        return false;
    }

    boolean this_present_simpleListField = true && this.isSetSimpleListField();
    boolean that_present_simpleListField = true && that.isSetSimpleListField();
    if (this_present_simpleListField || that_present_simpleListField) {
      if (!(this_present_simpleListField && that_present_simpleListField))
        return false;
      if (!this.simpleListField.equals(that.simpleListField))
        return false;
    }

    boolean this_present_complexListField = true && this.isSetComplexListField();
    boolean that_present_complexListField = true && that.isSetComplexListField();
    if (this_present_complexListField || that_present_complexListField) {
      if (!(this_present_complexListField && that_present_complexListField))
        return false;
      if (!this.complexListField.equals(that.complexListField))
        return false;
    }

    boolean this_present_simpleMapField = true && this.isSetSimpleMapField();
    boolean that_present_simpleMapField = true && that.isSetSimpleMapField();
    if (this_present_simpleMapField || that_present_simpleMapField) {
      if (!(this_present_simpleMapField && that_present_simpleMapField))
        return false;
      if (!this.simpleMapField.equals(that.simpleMapField))
        return false;
    }

    boolean this_present_complexMapField = true && this.isSetComplexMapField();
    boolean that_present_complexMapField = true && that.isSetComplexMapField();
    if (this_present_complexMapField || that_present_complexMapField) {
      if (!(this_present_complexMapField && that_present_complexMapField))
        return false;
      if (!this.complexMapField.equals(that.complexMapField))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    int hashCode = 1;

    hashCode = hashCode * 8191 + intField;

    hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(longField);

    hashCode = hashCode * 8191 + ((booleanField) ? 131071 : 524287);

    hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(doubleField);

    hashCode = hashCode * 8191 + ((isSetStringField()) ? 131071 : 524287);
    if (isSetStringField())
      hashCode = hashCode * 8191 + stringField.hashCode();

    hashCode = hashCode * 8191 + ((isSetEnumField()) ? 131071 : 524287);
    if (isSetEnumField())
      hashCode = hashCode * 8191 + enumField.getValue();

    hashCode = hashCode * 8191 + ((isSetOptionalStringField()) ? 131071 : 524287);
    if (isSetOptionalStringField())
      hashCode = hashCode * 8191 + optionalStringField.hashCode();

    hashCode = hashCode * 8191 + ((isSetNestedStructField()) ? 131071 : 524287);
    if (isSetNestedStructField())
      hashCode = hashCode * 8191 + nestedStructField.hashCode();

    hashCode = hashCode * 8191 + ((isSetSimpleListField()) ? 131071 : 524287);
    if (isSetSimpleListField())
      hashCode = hashCode * 8191 + simpleListField.hashCode();

    hashCode = hashCode * 8191 + ((isSetComplexListField()) ? 131071 : 524287);
    if (isSetComplexListField())
      hashCode = hashCode * 8191 + complexListField.hashCode();

    hashCode = hashCode * 8191 + ((isSetSimpleMapField()) ? 131071 : 524287);
    if (isSetSimpleMapField())
      hashCode = hashCode * 8191 + simpleMapField.hashCode();

    hashCode = hashCode * 8191 + ((isSetComplexMapField()) ? 131071 : 524287);
    if (isSetComplexMapField())
      hashCode = hashCode * 8191 + complexMapField.hashCode();

    return hashCode;
  }

  @Override
  public int compareTo(ComplexTypes other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.valueOf(isSetIntField()).compareTo(other.isSetIntField());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIntField()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.intField, other.intField);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetLongField()).compareTo(other.isSetLongField());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetLongField()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.longField, other.longField);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetBooleanField()).compareTo(other.isSetBooleanField());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBooleanField()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.booleanField, other.booleanField);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetDoubleField()).compareTo(other.isSetDoubleField());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDoubleField()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.doubleField, other.doubleField);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetStringField()).compareTo(other.isSetStringField());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStringField()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.stringField, other.stringField);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetEnumField()).compareTo(other.isSetEnumField());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetEnumField()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.enumField, other.enumField);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetOptionalStringField()).compareTo(other.isSetOptionalStringField());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetOptionalStringField()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.optionalStringField, other.optionalStringField);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetNestedStructField()).compareTo(other.isSetNestedStructField());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNestedStructField()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nestedStructField, other.nestedStructField);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetSimpleListField()).compareTo(other.isSetSimpleListField());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSimpleListField()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.simpleListField, other.simpleListField);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetComplexListField()).compareTo(other.isSetComplexListField());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetComplexListField()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.complexListField, other.complexListField);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetSimpleMapField()).compareTo(other.isSetSimpleMapField());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSimpleMapField()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.simpleMapField, other.simpleMapField);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetComplexMapField()).compareTo(other.isSetComplexMapField());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetComplexMapField()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.complexMapField, other.complexMapField);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  @org.apache.thrift.annotation.Nullable
  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    scheme(iprot).read(iprot, this);
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    scheme(oprot).write(oprot, this);
  }

  @Override
  public java.lang.String toString() {
    java.lang.StringBuilder sb = new java.lang.StringBuilder("ComplexTypes(");
    boolean first = true;

    sb.append("intField:");
    sb.append(this.intField);
    first = false;
    if (!first) sb.append(", ");
    sb.append("longField:");
    sb.append(this.longField);
    first = false;
    if (!first) sb.append(", ");
    sb.append("booleanField:");
    sb.append(this.booleanField);
    first = false;
    if (!first) sb.append(", ");
    sb.append("doubleField:");
    sb.append(this.doubleField);
    first = false;
    if (!first) sb.append(", ");
    sb.append("stringField:");
    if (this.stringField == null) {
      sb.append("null");
    } else {
      sb.append(this.stringField);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("enumField:");
    if (this.enumField == null) {
      sb.append("null");
    } else {
      sb.append(this.enumField);
    }
    first = false;
    if (isSetOptionalStringField()) {
      if (!first) sb.append(", ");
      sb.append("optionalStringField:");
      if (this.optionalStringField == null) {
        sb.append("null");
      } else {
        sb.append(this.optionalStringField);
      }
      first = false;
    }
    if (!first) sb.append(", ");
    sb.append("nestedStructField:");
    if (this.nestedStructField == null) {
      sb.append("null");
    } else {
      sb.append(this.nestedStructField);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("simpleListField:");
    if (this.simpleListField == null) {
      sb.append("null");
    } else {
      sb.append(this.simpleListField);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("complexListField:");
    if (this.complexListField == null) {
      sb.append("null");
    } else {
      sb.append(this.complexListField);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("simpleMapField:");
    if (this.simpleMapField == null) {
      sb.append("null");
    } else {
      sb.append(this.simpleMapField);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("complexMapField:");
    if (this.complexMapField == null) {
      sb.append("null");
    } else {
      sb.append(this.complexMapField);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // alas, we cannot check 'intField' because it's a primitive and you chose the non-beans generator.
    // alas, we cannot check 'longField' because it's a primitive and you chose the non-beans generator.
    // alas, we cannot check 'booleanField' because it's a primitive and you chose the non-beans generator.
    // alas, we cannot check 'doubleField' because it's a primitive and you chose the non-beans generator.
    if (stringField == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'stringField' was not present! Struct: " + toString());
    }
    if (enumField == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'enumField' was not present! Struct: " + toString());
    }
    if (nestedStructField == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'nestedStructField' was not present! Struct: " + toString());
    }
    if (simpleListField == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'simpleListField' was not present! Struct: " + toString());
    }
    if (complexListField == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'complexListField' was not present! Struct: " + toString());
    }
    // check for sub-struct validity
  }

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
    try {
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
      __isset_bitfield = 0;
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class ComplexTypesStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public ComplexTypesStandardScheme getScheme() {
      return new ComplexTypesStandardScheme();
    }
  }

  private static class ComplexTypesStandardScheme extends org.apache.thrift.scheme.StandardScheme<ComplexTypes> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, ComplexTypes struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
          break;
        }
        switch (schemeField.id) {
          case 1: // INT_FIELD
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.intField = iprot.readI32();
              struct.setIntFieldIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // LONG_FIELD
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.longField = iprot.readI64();
              struct.setLongFieldIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // BOOLEAN_FIELD
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.booleanField = iprot.readBool();
              struct.setBooleanFieldIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // DOUBLE_FIELD
            if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) {
              struct.doubleField = iprot.readDouble();
              struct.setDoubleFieldIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // STRING_FIELD
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.stringField = iprot.readString();
              struct.setStringFieldIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // ENUM_FIELD
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.enumField = org.apache.pinot.plugin.inputformat.thrift.TestEnum.findByValue(iprot.readI32());
              struct.setEnumFieldIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // OPTIONAL_STRING_FIELD
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.optionalStringField = iprot.readString();
              struct.setOptionalStringFieldIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // NESTED_STRUCT_FIELD
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.nestedStructField = new NestedType();
              struct.nestedStructField.read(iprot);
              struct.setNestedStructFieldIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 9: // SIMPLE_LIST_FIELD
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
                struct.simpleListField = new java.util.ArrayList<java.lang.String>(_list0.size);
                @org.apache.thrift.annotation.Nullable java.lang.String _elem1;
                for (int _i2 = 0; _i2 < _list0.size; ++_i2)
                {
                  _elem1 = iprot.readString();
                  struct.simpleListField.add(_elem1);
                }
                iprot.readListEnd();
              }
              struct.setSimpleListFieldIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 10: // COMPLEX_LIST_FIELD
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list3 = iprot.readListBegin();
                struct.complexListField = new java.util.ArrayList<NestedType>(_list3.size);
                @org.apache.thrift.annotation.Nullable NestedType _elem4;
                for (int _i5 = 0; _i5 < _list3.size; ++_i5)
                {
                  _elem4 = new NestedType();
                  _elem4.read(iprot);
                  struct.complexListField.add(_elem4);
                }
                iprot.readListEnd();
              }
              struct.setComplexListFieldIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 15: // SIMPLE_MAP_FIELD
            if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
              {
                org.apache.thrift.protocol.TMap _map6 = iprot.readMapBegin();
                struct.simpleMapField = new java.util.HashMap<java.lang.String,java.lang.Integer>(2*_map6.size);
                @org.apache.thrift.annotation.Nullable java.lang.String _key7;
                int _val8;
                for (int _i9 = 0; _i9 < _map6.size; ++_i9)
                {
                  _key7 = iprot.readString();
                  _val8 = iprot.readI32();
                  struct.simpleMapField.put(_key7, _val8);
                }
                iprot.readMapEnd();
              }
              struct.setSimpleMapFieldIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 16: // COMPLEX_MAP_FIELD
            if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
              {
                org.apache.thrift.protocol.TMap _map10 = iprot.readMapBegin();
                struct.complexMapField = new java.util.HashMap<java.lang.String,NestedType>(2*_map10.size);
                @org.apache.thrift.annotation.Nullable java.lang.String _key11;
                @org.apache.thrift.annotation.Nullable NestedType _val12;
                for (int _i13 = 0; _i13 < _map10.size; ++_i13)
                {
                  _key11 = iprot.readString();
                  _val12 = new NestedType();
                  _val12.read(iprot);
                  struct.complexMapField.put(_key11, _val12);
                }
                iprot.readMapEnd();
              }
              struct.setComplexMapFieldIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

      // check for required fields of primitive type, which can't be checked in the validate method
      if (!struct.isSetIntField()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'intField' was not found in serialized data! Struct: " + toString());
      }
      if (!struct.isSetLongField()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'longField' was not found in serialized data! Struct: " + toString());
      }
      if (!struct.isSetBooleanField()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'booleanField' was not found in serialized data! Struct: " + toString());
      }
      if (!struct.isSetDoubleField()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'doubleField' was not found in serialized data! Struct: " + toString());
      }
      struct.validate();
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot, ComplexTypes struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(INT_FIELD_FIELD_DESC);
      oprot.writeI32(struct.intField);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(LONG_FIELD_FIELD_DESC);
      oprot.writeI64(struct.longField);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(BOOLEAN_FIELD_FIELD_DESC);
      oprot.writeBool(struct.booleanField);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(DOUBLE_FIELD_FIELD_DESC);
      oprot.writeDouble(struct.doubleField);
      oprot.writeFieldEnd();
      if (struct.stringField != null) {
        oprot.writeFieldBegin(STRING_FIELD_FIELD_DESC);
        oprot.writeString(struct.stringField);
        oprot.writeFieldEnd();
      }
      if (struct.enumField != null) {
        oprot.writeFieldBegin(ENUM_FIELD_FIELD_DESC);
        oprot.writeI32(struct.enumField.getValue());
        oprot.writeFieldEnd();
      }
      if (struct.optionalStringField != null) {
        if (struct.isSetOptionalStringField()) {
          oprot.writeFieldBegin(OPTIONAL_STRING_FIELD_FIELD_DESC);
          oprot.writeString(struct.optionalStringField);
          oprot.writeFieldEnd();
        }
      }
      if (struct.nestedStructField != null) {
        oprot.writeFieldBegin(NESTED_STRUCT_FIELD_FIELD_DESC);
        struct.nestedStructField.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.simpleListField != null) {
        oprot.writeFieldBegin(SIMPLE_LIST_FIELD_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.simpleListField.size()));
          for (java.lang.String _iter14 : struct.simpleListField)
          {
            oprot.writeString(_iter14);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.complexListField != null) {
        oprot.writeFieldBegin(COMPLEX_LIST_FIELD_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.complexListField.size()));
          for (NestedType _iter15 : struct.complexListField)
          {
            _iter15.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.simpleMapField != null) {
        oprot.writeFieldBegin(SIMPLE_MAP_FIELD_FIELD_DESC);
        {
          oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.I32, struct.simpleMapField.size()));
          for (java.util.Map.Entry<java.lang.String, java.lang.Integer> _iter16 : struct.simpleMapField.entrySet())
          {
            oprot.writeString(_iter16.getKey());
            oprot.writeI32(_iter16.getValue());
          }
          oprot.writeMapEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.complexMapField != null) {
        oprot.writeFieldBegin(COMPLEX_MAP_FIELD_FIELD_DESC);
        {
          oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRUCT, struct.complexMapField.size()));
          for (java.util.Map.Entry<java.lang.String, NestedType> _iter17 : struct.complexMapField.entrySet())
          {
            oprot.writeString(_iter17.getKey());
            _iter17.getValue().write(oprot);
          }
          oprot.writeMapEnd();
        }
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class ComplexTypesTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public ComplexTypesTupleScheme getScheme() {
      return new ComplexTypesTupleScheme();
    }
  }

  private static class ComplexTypesTupleScheme extends org.apache.thrift.scheme.TupleScheme<ComplexTypes> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, ComplexTypes struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      oprot.writeI32(struct.intField);
      oprot.writeI64(struct.longField);
      oprot.writeBool(struct.booleanField);
      oprot.writeDouble(struct.doubleField);
      oprot.writeString(struct.stringField);
      oprot.writeI32(struct.enumField.getValue());
      struct.nestedStructField.write(oprot);
      {
        oprot.writeI32(struct.simpleListField.size());
        for (java.lang.String _iter18 : struct.simpleListField)
        {
          oprot.writeString(_iter18);
        }
      }
      {
        oprot.writeI32(struct.complexListField.size());
        for (NestedType _iter19 : struct.complexListField)
        {
          _iter19.write(oprot);
        }
      }
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetOptionalStringField()) {
        optionals.set(0);
      }
      if (struct.isSetSimpleMapField()) {
        optionals.set(1);
      }
      if (struct.isSetComplexMapField()) {
        optionals.set(2);
      }
      oprot.writeBitSet(optionals, 3);
      if (struct.isSetOptionalStringField()) {
        oprot.writeString(struct.optionalStringField);
      }
      if (struct.isSetSimpleMapField()) {
        {
          oprot.writeI32(struct.simpleMapField.size());
          for (java.util.Map.Entry<java.lang.String, java.lang.Integer> _iter20 : struct.simpleMapField.entrySet())
          {
            oprot.writeString(_iter20.getKey());
            oprot.writeI32(_iter20.getValue());
          }
        }
      }
      if (struct.isSetComplexMapField()) {
        {
          oprot.writeI32(struct.complexMapField.size());
          for (java.util.Map.Entry<java.lang.String, NestedType> _iter21 : struct.complexMapField.entrySet())
          {
            oprot.writeString(_iter21.getKey());
            _iter21.getValue().write(oprot);
          }
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, ComplexTypes struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      struct.intField = iprot.readI32();
      struct.setIntFieldIsSet(true);
      struct.longField = iprot.readI64();
      struct.setLongFieldIsSet(true);
      struct.booleanField = iprot.readBool();
      struct.setBooleanFieldIsSet(true);
      struct.doubleField = iprot.readDouble();
      struct.setDoubleFieldIsSet(true);
      struct.stringField = iprot.readString();
      struct.setStringFieldIsSet(true);
      struct.enumField = org.apache.pinot.plugin.inputformat.thrift.TestEnum.findByValue(iprot.readI32());
      struct.setEnumFieldIsSet(true);
      struct.nestedStructField = new NestedType();
      struct.nestedStructField.read(iprot);
      struct.setNestedStructFieldIsSet(true);
      {
        org.apache.thrift.protocol.TList _list22 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
        struct.simpleListField = new java.util.ArrayList<java.lang.String>(_list22.size);
        @org.apache.thrift.annotation.Nullable java.lang.String _elem23;
        for (int _i24 = 0; _i24 < _list22.size; ++_i24)
        {
          _elem23 = iprot.readString();
          struct.simpleListField.add(_elem23);
        }
      }
      struct.setSimpleListFieldIsSet(true);
      {
        org.apache.thrift.protocol.TList _list25 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
        struct.complexListField = new java.util.ArrayList<NestedType>(_list25.size);
        @org.apache.thrift.annotation.Nullable NestedType _elem26;
        for (int _i27 = 0; _i27 < _list25.size; ++_i27)
        {
          _elem26 = new NestedType();
          _elem26.read(iprot);
          struct.complexListField.add(_elem26);
        }
      }
      struct.setComplexListFieldIsSet(true);
      java.util.BitSet incoming = iprot.readBitSet(3);
      if (incoming.get(0)) {
        struct.optionalStringField = iprot.readString();
        struct.setOptionalStringFieldIsSet(true);
      }
      if (incoming.get(1)) {
        {
          org.apache.thrift.protocol.TMap _map28 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.I32, iprot.readI32());
          struct.simpleMapField = new java.util.HashMap<java.lang.String,java.lang.Integer>(2*_map28.size);
          @org.apache.thrift.annotation.Nullable java.lang.String _key29;
          int _val30;
          for (int _i31 = 0; _i31 < _map28.size; ++_i31)
          {
            _key29 = iprot.readString();
            _val30 = iprot.readI32();
            struct.simpleMapField.put(_key29, _val30);
          }
        }
        struct.setSimpleMapFieldIsSet(true);
      }
      if (incoming.get(2)) {
        {
          org.apache.thrift.protocol.TMap _map32 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
          struct.complexMapField = new java.util.HashMap<java.lang.String,NestedType>(2*_map32.size);
          @org.apache.thrift.annotation.Nullable java.lang.String _key33;
          @org.apache.thrift.annotation.Nullable NestedType _val34;
          for (int _i35 = 0; _i35 < _map32.size; ++_i35)
          {
            _key33 = iprot.readString();
            _val34 = new NestedType();
            _val34.read(iprot);
            struct.complexMapField.put(_key33, _val34);
          }
        }
        struct.setComplexMapFieldIsSet(true);
      }
    }
  }

  private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
    return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
  }
}
